home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / PASCAL / DRVTYP20.ZIP / DRIVES.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-08  |  2.7 KB  |  82 lines

  1. { --------------------------------------------------------------------------- }
  2. { DRIVES.PAS  DrvTypes unit demonstration program.        Version 2.00  }
  3. {                                                                             }
  4. { *** PUBLIC DOMAIN ***                                                       }
  5. { *** THERE ARE NO WARRANTIES TO THIS CODE AND AS-IS BASIS IS ASSUMED ***     }
  6. {                                                                             }
  7. { Written by Bobby Z. and Mr. Byte                                            }
  8. { --------------------------------------------------------------------------- }
  9.  
  10. Program Drives;
  11.  
  12. {$M 2048,0,0} { stacksize = 2048 bytes, safe }
  13. {$S-,I-,R-}   { disable stack, I/O and range checking }
  14.  
  15. uses DrvTypes;
  16.  
  17. function FloppyDrives : byte; assembler;
  18. { - returns number of floppy drives in system }
  19. asm
  20.         int 11h
  21.         test al,00000001b
  22.         jz  @@1
  23. {$IFOPT G+}
  24.         shr al,6
  25. {$ELSE}
  26.         mov cl,6
  27.         shr al,cl
  28. {$ENDIF}
  29.         and al,3
  30.         inc al
  31.         retn
  32. @@1:
  33.         xor al,al
  34. end;
  35.  
  36. var C : Char;
  37.     T : array[1..26] of Byte;
  38.     D : Word;
  39.  
  40. procedure WriteDescription( C : Char; const Desc : String );
  41.  begin
  42.   WriteLn('Drive ',C,': is ',Desc);
  43.  end;
  44.  
  45. begin
  46.  WriteLn('Drive Map  Version 2.0  Written by Mr. Byte and Bobby Z.'#13#10);
  47.  asm
  48.     mov    ah,30h
  49.     int    21h
  50.     mov    D,ax
  51.  end;
  52.  if (Lo(D) < 3) or ((Lo(D)=3) and (Hi(D) < 30)) then
  53.   begin
  54.    WriteLn('DOS version is ',Hi(D),'.',Lo(D),'!!! Where did you get this dinosaur?');
  55.    Halt;
  56.   end;
  57.  Write('Scanning drives, please wait...');
  58.  for C := #1 to #26 do
  59.   T[Byte(C)] := GetDriveType(Byte(C));
  60.  Write(#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8#8);
  61.  for C := 'A' to 'Z' do
  62.   case T[Byte(C)-Byte('A')+1] of
  63.    dtCDROM : WriteDescription(C,'CD-ROM drive.');
  64.    dtSUBST : WriteDescription(C,'SUBST''ed drive.');
  65.    dtRemote: WriteDescription(C,'remote (network) drive.');
  66.    dtFixed : WriteDescription(C,'local hard drive.');
  67.    dtRemovable:
  68.        if (Byte(C)-Byte('A')+1) in [1..FloppyDrives] then
  69.         WriteDescription(C,'removable (floppy) drive.')
  70.        else
  71.         WriteDescription(C,'phantom floppy drive.');
  72.    dtDblSpace: WriteDescription(C,'DoubleSpace compressed drive.');
  73.    { need Stacker 1,2,3 check algos badly... }
  74.    dtStacker4: WriteDescription(C,'Stacker 4 compressed drive.');
  75.    dtRAMDrive: WriteDescription(C,'RAM drive.');
  76.    dtDublDisk: WriteDescription(C,'Vertisoft DoubleDisk 2.6 compressed drive.');
  77.    dtBernoully: WriteDescription(C,'Bernoully drive.');
  78.    dtDiskreet: WriteDescription(C, 'Norton Diskreet drive.');
  79.    dtSuperStor: WriteDescription(C, 'SuperStor compressed drive.')
  80.   end
  81. end. { Drives }
  82.